package cn.iocoder.yudao.module.wms.api.warehouse;

import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.wms.api.warehouse.dto.PositionRespDTO;
import cn.iocoder.yudao.module.wms.api.warehouse.dto.WarehouseRespDTO;
import cn.iocoder.yudao.module.wms.dal.dataobject.warehouse.PositionDO;
import cn.iocoder.yudao.module.wms.dal.dataobject.warehouse.WarehouseDO;
import cn.iocoder.yudao.module.wms.service.warehouse.WarehouseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

/**
 * @Author: Ljx
 * @createTime: 2024年04月21日 17:18:07
 * @version: v1.0.0
 * @Description: 仓库API实现
 */
@Service
public class WarehouseApiImpl implements WarehouseApi{
    @Resource
    private WarehouseService warehouseService;
    @Override
    public WarehouseRespDTO getWarehouse(Long id) {
        WarehouseDO warehouse = warehouseService.getWarehouse(id);
        return BeanUtils.toBean(warehouse, WarehouseRespDTO.class);
    }

    @Override
    public List<WarehouseRespDTO> getWarehouseList(Collection<Long> ids) {
        List<WarehouseDO> warehouseList = warehouseService.getWarehouseListById(ids);
        return BeanUtils.toBean(warehouseList, WarehouseRespDTO.class);
    }

    @Override
    public PositionRespDTO getPosition(Long id) {
        PositionDO position = warehouseService.getPosition(id);
        return BeanUtils.toBean(position, PositionRespDTO.class);
    }

    @Override
    public List<PositionRespDTO> getPositionList(Collection<Long> ids) {
        List<PositionDO> positionList = warehouseService.getPositionListById(ids);
        return BeanUtils.toBean(positionList, PositionRespDTO.class);
    }
}
